# This makefile uses pattern matching
# So if you update your header files you MUST clean the project before building

# Configuring
CC= gcc
LD= gcc
CFLAGS= -c -Wall -Wextra -pedantic
LDFLAGS=  
LDLIBS= 

# Sources
SRCS= main.c base.c utils.c

# Objects
OBJS= $(SRCS:.c=.o)

# Targets
all: myapp.x

myapp.x: $(OBJS)
	@echo Linking $@
	@$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

clean:
	@rm *.o myapp.x

# Compiling, using pattern matching
%.o: %.c
	@echo $@
	@$(CC) $(CFLAGS) -o $@ $<

.PHONY: all clean